<template>
	<view class="ikz-school">
		<ikz-loading :css-data="loading_css"></ikz-loading>
		<ikz-topbg></ikz-topbg>
		<!-- <view class="ikz-seach">
      <image class="ikz-search-img" src="/static/campus/search.png"></image>
      <input class="ikz-search-input" placeholder="请输入关键词搜索学校" @input="eventHandle" />
    </view> -->
		<image class="ikz-top-bg" :src="service_img" mode="widthFix"></image>
		<view style="height: 20rpx;">

		</view>
		<ikz-list :show-data="list_data" :css-data="list_css" @returnList="returnList"></ikz-list>
	</view>
</template>

<script>
	import ikzLoading from '@/pages/Component/Public/Loading/loading.vue';
	import ikzList from '@/pages/Component/Public/List/public/list/list.vue';
	import ikzTopbg from '@/pages/Component/Public/Topbg/public/topbg/topbg.vue';
	var app = getApp();
	import ikz from '@/pages/Common/tools.js';
	export default {
		components: {
			ikzList,
			ikzLoading,
			ikzTopbg
		},
		data() {
			return {
				list_data: {
					list: []
				},
				list_css: {
					background_color: '#fff',
					border_radius: 15
				},
				loading_css: {
					display: 'flex',
				},
				service_img:app.globalData.service_img,
			}
		},
		created() {
			this.pointInfo((res) => {
				this.loading_css.display = 'none';
			})
			// var that = this;
		},
		methods: {
			pointInfo(fn) {
				var path = '/xyb/express/index';
				var data = {}
				ikz.post(path, data, res => {
					if (res.data.code) {
						var temp_data = res.data.data.data;
						for (var i = 0; i < temp_data.length; i++) {
							var temp = {
								id: temp_data[i].id,
								title: temp_data[i].name
							}
							this.list_data.list.push(temp);
						}
						console.log(this.list_data)
						this.$forceUpdate();
					} else {
						uni.showModal({
							title: '提示',
							content: res.data.msg,
							showCancel: false,
							success: function(res) {}
						});
					}
					fn();
				})
			},
			//点击组件返回
			returnList(e) {
				uni.showModal({
					title: '提示',
					content: '是否选择' + e.title,
					success: function(res) {
						cancel: true
						confirm: false
						if (res.confirm) {
							app.globalData.point_info = e;
							uni.navigateBack({
								delta: 1
							});
						}

					},
					fail: function(res) {

					}
				});
			},
		}
	};
</script>

<style>
	page {
		width: 100%;
		height: 100%;
		background: #F3F3F3;
	}

	.ikz-school {
		width: 100%;
		height: 100%;
	}

	.ikz-top-bg {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		z-index: -1;
	}

	.ikz-seach {
		width: 80%;
		margin: 30rpx auto;
		border-radius: 50rpx;
		background-color: #fff;
		height: 80rpx;
		display: flex;
		align-items: center;

	}

	.ikz-search-img {
		width: 40rpx;
		height: 40rpx;
		margin: 0 30rpx;
	}
</style>
